package net.lab1024.sa.admin.module.business.bjd.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.bjd.domain.form.UserDollBindForm;
import net.lab1024.sa.admin.module.business.bjd.domain.form.UserDollBindQueryForm;
import net.lab1024.sa.admin.module.business.bjd.domain.form.UserQueryForm;
import net.lab1024.sa.admin.module.business.bjd.domain.vo.UserDollBindVo;
import net.lab1024.sa.admin.module.business.bjd.domain.vo.UserVo;
import net.lab1024.sa.admin.module.business.bjd.service.UserDollBindService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 *
 * @author guolong.zhang
 * @date 2025/02/09 09:51
 **/
@RestController
@Tag(name = "娃娃绑定管理")
public class UserDollBindController {

    @Autowired
    private UserDollBindService bindService;

    @Operation(summary = "分页查询")
    @PostMapping("/bjd/userDollBind/queryPage")
    public ResponseDTO<PageResult<UserDollBindVo>> queryPage(@RequestBody @Valid UserDollBindQueryForm queryForm) {
        return ResponseDTO.ok(bindService.queryPage(queryForm));
    }

    @Operation(summary = "解绑娃娃")
    @PostMapping("/bjd/userDollBind/unbind")
    public ResponseDTO<Void> unbind(@RequestBody @Valid UserDollBindForm req) {
        bindService.unbind(req);
        return ResponseDTO.ok();
    }

}
